﻿using Console.Model;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Console
{
    public class CodeFirstDbContext : DbContext
    {

        public CodeFirstDbContext() : base("name=MyStrConn")
        {
            Database.SetInitializer<CodeFirstDbContext>(new DropCreateDatabaseIfModelChanges<CodeFirstDbContext>());
        }
        public DbSet<Student> Students { get; set; }
        public DbSet<IDCard> IDCard { get; set; }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            // Moved all Student related configuration to StudentEntityConfiguration class
            modelBuilder.Configurations.AddFromAssembly(Assembly.GetExecutingAssembly());

        }
    }
}
